﻿using MongoDB.Driver;
using Sustainalytics.Entities.RiskRatings;
using System.Threading.Tasks;

namespace Sustainalytics.ClientDW.Synchronization.SyncRiskRatingsData.Indexes
{
    public static class RiskRatingClusterIndexes
    {
        public static async Task RecreateIndexes(IMongoCollection<RiskRatingCluster> collection)
        {
            await collection.Indexes.CreateOneAsync(Builders<RiskRatingCluster>.IndexKeys.Ascending(x => x.Id)).ConfigureAwait(false);
            await collection.Indexes.CreateOneAsync(Builders<RiskRatingCluster>.IndexKeys.Ascending(x => x.Assessment)).ConfigureAwait(false);
        }

        public static async Task RecreateIndexes(IMongoCollection<ManagementCluster> collection)
        {
            await collection.Indexes.CreateOneAsync(Builders<ManagementCluster>.IndexKeys.Ascending(x => x.Id)).ConfigureAwait(false);
            await collection.Indexes.CreateOneAsync(Builders<ManagementCluster>.IndexKeys.Ascending(x => x.Assessment)).ConfigureAwait(false);
        }

        public static async Task RecreateIndexes(IMongoCollection<ManageableCluster> collection)
        {
            await collection.Indexes.CreateOneAsync(Builders<ManageableCluster>.IndexKeys.Ascending(x => x.Id)).ConfigureAwait(false);
            await collection.Indexes.CreateOneAsync(Builders<ManageableCluster>.IndexKeys.Ascending(x => x.Assessment)).ConfigureAwait(false);
        }

        public static async Task RecreateIndexes(IMongoCollection<ExposureCluster> collection)
        {
            await collection.Indexes.CreateOneAsync(Builders<ExposureCluster>.IndexKeys.Ascending(x => x.Id)).ConfigureAwait(false);
            await collection.Indexes.CreateOneAsync(Builders<ExposureCluster>.IndexKeys.Ascending(x => x.Assessment)).ConfigureAwait(false);
        }
    }
}